/**
 * 
 */
package com.designpattern.design.facade;

/**
 * 外观模式-外观
 * 
 * @author zhangyang
 *
 */
public class HomeFacadeTest {
	
	public static void main(String[] args) {
		//创建一个外观类
		HomeFacade facade=new HomeFacade();
		//开始选择执行方法
		facade.ready();
		facade.play();
	}
	
}

class HomeFacade{
	// 定义各个子系统对象
	DvdPlayer dvdPlayer;
	TV tv;
	Projector project;
	Screen screen;

	// 初始化构造器
	public HomeFacade() {
		dvdPlayer = DvdPlayer.getInstance();
		tv = TV.getInstance();
		project = Projector.getInstance();
		screen = Screen.getInstance();

	}

	/**
	 * 开始准备 所有设备按照顺序打开
	 */
	public void ready() {
		dvdPlayer.on();
		tv.on();
		project.on();
		screen.up();
	}
	
	/**
	 * 播放
	 */
	public void play() {
		dvdPlayer.play();
	}
	
	/**
	 * 暂停
	 */
	public void pause() {
		dvdPlayer.pause();
	}
	
	/**
	 * 继续播放
	 */
	public void procceed() {
		dvdPlayer.procceed();
	}
	/**
	 * 同样的逻辑关闭
	 */
}
